/* 
 * This program is free software; you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; either version 3 of the License, or 
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 * for more details.
 * 
 * You should have received a copy of the GNU General Public License along 
 * with this program; if not, write to the Free Software Foundation, Inc., 
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#include <QRegExp>
#include "log.h"
#include "components/chan.h"
#include "components/board.h"
#include "tasks/tasksendpost.h"
#include "kusabaagent.h"

namespace Wishmaster
{
    class KusabaTaskSendPost : public TaskSendPost
    {
    	Q_OBJECT
    public:
    	KusabaTaskSendPost(const PostDescriptor& post, const QString& captcha, Wishmaster2::Network::RequestManager* requestManager,
    			const QString& msg, KusabaAgent* agent);

    	ThreadId threadId() const;

    signals:
    	void result(KusabaTaskSendPost* task, const QByteArray& data, const QString& contentType);

    protected:
    	virtual Wishmaster2::Network::RequestPtr makeRequest(const PostDescriptor& post, const QString& captcha,
    			Wishmaster2::Network::RequestManager* requestManager);

    	virtual void onRequestDone();

    private:
    	PostDescriptor m_post;
    	QString m_captcha;
    	Wishmaster2::Network::RequestPtr m_request;
    	Wishmaster2::Network::RequestManager* m_requestManager;
    	KusabaAgent* m_agent;
    	bool m_error;
    	QString m_errorMsg;
        };
}

